package com.mall.model.vo;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mall.model.domain.PmsProduct;
import com.mall.model.domain.SmsFlashPromotionProductRelation;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@NoArgsConstructor
@Data
public class SmsFlashPromotionProductRelationVo {

    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     *
     */
    private Long flashPromotionId;

    /**
     * 编号
     */
    private Long flashPromotionSessionId;

    /**
     *
     */
    private Long productId;

    /**
     * 限时购价格
     */
    private BigDecimal flashPromotionPrice;

    /**
     * 限时购数量
     */
    private Integer flashPromotionCount;

    /**
     * 每人限购数量
     */
    private Integer flashPromotionLimit;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 关联商品
     */
    private PmsProduct product;

    public static SmsFlashPromotionProductRelationVo init(SmsFlashPromotionProductRelation relation, PmsProduct product) {

        SmsFlashPromotionProductRelationVo vo = new SmsFlashPromotionProductRelationVo();
        BeanUtil.copyProperties(relation, vo);
        vo.setProduct(product);
        return vo;
    }


}
